package com.bjpowernode.springboot.config;

import com.bjpowernode.springboot.servlet.MyServlet1;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration//该注解将此类定义为配置类，相当于xml文件
public class ServletConfig {


    @Bean//是一个方法级别上的注解，主要用在配置类上，相当于一个<beans></beans>标签
    public ServletRegistrationBean myServletRegistrationBean(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new MyServlet1(),
                "/myservlet/*");

        return servletRegistrationBean;
    }
}
